import LocalStorage from "../../engine/LocalStorage";
import { GameConfig } from "./GameConfig";
import { RoomConfig } from "./RoomConfig";

const Local_Key: string = "RoomConfig_Mj"

export default class RoomConfig_Mj extends RoomConfig {

    public gameType: number = GameConfig.Game_Type.Mj

    //人数配置
    public static renshuConfig: Array<number> = [
        4, 3, 2
    ]

    //局数配置
    public static jushuConfig: Array<number> = [
        4, 8, 12
    ]


    //局数花费钻石配置
    public static fangfeiConfig: Array<Array<number>> = [
        [40, 60, 80],
        [30, 45, 60],
        [20, 30, 40],
    ]

    //底分配置
    public static difenConfig: Array<number> = [
       1, 2, 3, 4, 5, 10, 20
    ]


    public dianpao_type: number = 0; //
    public static dianpao_type = {
        dianpao_sanjiashu: 0, //点炮3家输
        dianpao_shu: 1, //谁点炮谁输
        dianpao_shu_all: 2, //点炮包赔
    }

    public static dianpao_type_name: Array<string> = [
        "点炮3家输", "谁点炮谁输", "点炮包赔"
    ]


    constructor() {
        super()
    }


    public static createConfig() {
        let config: RoomConfig_Mj = new RoomConfig_Mj()
        let str: string = LocalStorage.getItem(Local_Key)
        if (str) {
            try {
                // let obj: object = JSON.parse(str)
                // config.jushu = obj["jushu"]
                // config.renshu = obj["renshu"]
                // config.distance_limit = obj["distance_limit"]
            } catch (error) {

            }
        }
        return config
    }

    public static saveConfig(config: RoomConfig_Mj) {
        LocalStorage.setItem(Local_Key, JSON.stringify(config))
    }

}
